﻿using Pattern23责任链模式.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pattern23责任链模式.Models
{
    public class Manager : HandlerBase
    {
        public override void Approve(Order order)
        {
            if(order == null) 
            {
                throw new ArgumentNullException("订单不能为空！");
            }

            if (order.Amount <= 5000)
            {
                Console.WriteLine($"{order.Name}的订单为{order.Amount}，经理审核即可");
            }
            else
            {
                if (NextHandler != null)
                {
                    NextHandler.Approve(order);
                }
                else
                {
                    Console.WriteLine("审核人不在");
                }
            }
        }
    }
}
